//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>

//---------------------------------------------------------------------------
#include "Borland\\canlib.h"

struct TWMCanLib
{
    Cardinal Msg;
    DWORD hnd;
    WORD event;
    WORD _pad;
    Longint Result;
};
typedef struct
{
   unsigned int id;
   unsigned int dlc;
   unsigned char data[8];
}CanMessage;

DWORD Handle1, Handle2;

bool flagTo83Mode = false;
bool flagTo87Mode = false;
bool flagToSecAccess = false;
bool flagToWriteData = false;
bool flagToStartRoutine = false;
bool flagToStopRoutine = false;
bool flagToECUReset = false;
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
        TPageControl *PageControl1;
        TTabSheet *TabSheet1;
        TTabSheet *TabSheet2;
        TGroupBox *GroupBox1;
        TComboBox *ComboBox1;
        TButton *Button1;
        TButton *Button2;
        TButton *Button3;
        TButton *Button4;
        TButton *Button5;
        TGroupBox *GroupBox2;
        TButton *Button6;
        TButton *Button7;
        TGroupBox *GroupBox3;
        TComboBox *ComboBox2;
        TButton *Button8;
        TButton *Button9;
        TGroupBox *GroupBox5;
        TComboBox *ComboBox3;
        TComboBox *ComboBox4;
        TComboBox *ComboBox5;
        TButton *Button10;
        TButton *Button11;
        TGroupBox *GroupBox4;
        TGroupBox *GroupBox6;
        TGroupBox *GroupBox7;
        TGroupBox *GroupBox8;
        TGroupBox *GroupBox9;
        TGroupBox *GroupBox10;
        TRadioButton *RadioButton1;
        TRadioButton *RadioButton2;
        TRadioButton *RadioButton3;
        TRadioButton *RadioButton4;
        TRadioButton *RadioButton5;
        TButton *Button12;
        TButton *Button13;
        TRadioButton *RadioButton6;
        TRadioButton *RadioButton7;
        TRadioButton *RadioButton8;
        TRadioButton *RadioButton9;
        TButton *Button14;
        TButton *Button15;
        TButton *Button16;
        TButton *Button17;
        TRadioButton *RadioButton10;
        TRadioButton *RadioButton11;
        TRadioButton *RadioButton12;
        TRadioButton *RadioButton13;
        TButton *Button18;
        TButton *Button19;
        TRadioButton *RadioButton14;
        TRadioButton *RadioButton15;
        TRadioButton *RadioButton16;
        TRadioButton *RadioButton17;
        TRadioButton *RadioButton18;
        TButton *OFF;
        TButton *ON;
        TMemo *Memo1;
        TGroupBox *GroupBox11;
        TComboBox *ComboBox6;
        TButton *Button20;
        TButton *Button21;
        TButton *Button22;
        TButton *Button23;
        TButton *Button24;
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall Button1Click(TObject *Sender);
        void __fastcall Button2Click(TObject *Sender);
        void __fastcall Button5Click(TObject *Sender);
        void __fastcall Button3Click(TObject *Sender);
        void __fastcall Button4Click(TObject *Sender);
        void __fastcall Button10Click(TObject *Sender);
        void __fastcall Button11Click(TObject *Sender);
        void __fastcall Button8Click(TObject *Sender);
        void __fastcall Button9Click(TObject *Sender);
        void __fastcall Button6Click(TObject *Sender);
        void __fastcall Button7Click(TObject *Sender);
        void __fastcall Button12Click(TObject *Sender);
        void __fastcall Button13Click(TObject *Sender);
        void __fastcall Button14Click(TObject *Sender);
        void __fastcall Button15Click(TObject *Sender);
        void __fastcall Button16Click(TObject *Sender);
        void __fastcall Button17Click(TObject *Sender);
        void __fastcall Button18Click(TObject *Sender);
        void __fastcall Button19Click(TObject *Sender);
        void __fastcall ONClick(TObject *Sender);
        void __fastcall OFFClick(TObject *Sender);
private:	// User declarations
//---------------------------------------------------------------------------
void __fastcall WMCanLib(TWMCanLib& Message);
    BEGIN_MESSAGE_MAP
        MESSAGE_HANDLER(WM__CANLIB/*17378*/, TWMCanLib, WMCanLib); //WM_USER
    END_MESSAGE_MAP(TForm)
//---------------------------------------------------------------------------

public:		// User declarations
        __fastcall TForm1(TComponent* Owner);
        void __fastcall msgDisplay(CanMessage* messageTx, int flagRxTx);
        Word __fastcall calcKey(Word seed);
        void __fastcall checkSend();
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
